Engine

interface Engine : Closeable, Observable<T>

Provides access to the Chromium engine functionality.

To perform operations with the engine, a license key is required. The license key represents a string that can be set via the "jxbrowser.license.key" system property or individually for every Engine using the licenseKey method. If you set the license key via the system property, then please make sure that you set it before creating an Engine instance.

The Chromium engine is running in a separate native process. Communication between the native and Java process is done through the Inter-Process Communication (IPC) layer that allows transferring data between two processes on a local machine.

The native process allocates memory and system resources that must be released. So, when the engine is no longer needed, it must be closed through the close method to shutdown the native process and free all the allocated memory and system resources. For example:

Engine engine = Engine.newInstance(engineOptions);
...
engine.close();

Any attempt to use an already closed engine will lead to the IllegalStateException.

To get notifications that the Engine instance has been closed subscribe to the following event:


engine.on(EngineClosed.class, event -> {
    // The engine has been closed.
});
To get notifications that the Engine instance has been unexpectedly terminated use:

engine.on(EngineCrashed.class, event -> {
    // The engine has been unexpectedly terminated.
});

Properties

Link copied to clipboard

A store that allows managing cookies.

Link copied to clipboard

A service that allows managing downloads.

Link copied to clipboard

A service for working with HTTP authentication cache.

Link copied to clipboard

A service for working with HTTP cache.

Link copied to clipboard

Returns a license that was used to create this Engine.

Link copied to clipboard

A service that allows managing media stream devices.

Link copied to clipboard

A service that allows working with network.

Link copied to clipboard

Returns options of this Engine.

Link copied to clipboard

A service that allows managing permissions.

Link copied to clipboard

A service that allows configuring plugins.

Link copied to clipboard

A service for managing profiles.

Link copied to clipboard

A service that allows working with proxy.

Link copied to clipboard

A service that allows working with spell checking functionality.

Link copied to clipboard

A service that allows working with zoom.

Functions

Link copied to clipboard
abstract fun browsers(): List<Browser>
Returns an immutable list of alive Browser instances including child popup browsers for the default profile.
Link copied to clipboard
abstract fun close()
Closes this object and releases all resources associated with it.
abstract fun close()
Link copied to clipboard
abstract fun cookieStore(): CookieStore
Returns the cookie store that allows managing cookies.
Link copied to clipboard
abstract fun downloads(): Downloads
Returns a service that allows managing downloads.
Link copied to clipboard
Returns a service for working with HTTP authentication cache.
Link copied to clipboard
abstract fun httpCache(): HttpCache
Returns a service for working with HTTP cache.
Link copied to clipboard
abstract fun isClosed(): Boolean
Returns true if the current object is closed.
Link copied to clipboard
abstract fun mediaDevices(): MediaDevices
Returns a service that allows managing media stream devices.
Link copied to clipboard
abstract fun network(): Network
Returns a service that allows working with network.
Link copied to clipboard
abstract fun newBrowser(): Browser
Creates a new Browser instance under the default profile and navigates it to the "about:blank" web page within the defaultTimeout.
Link copied to clipboard
open fun newInstance(options: EngineOptions): Engine
Initializes and runs the Chromium engine with the given options.
open fun newInstance(renderingMode: RenderingMode): Engine
Initializes and runs the Chromium engine in the given renderingMode.
Link copied to clipboard
abstract fun <E : T?> on(eventClass: Class<E>, observer: Observer<E>): Subscription
Subscribes the given event observer to receive the events of the given eventClass.
Link copied to clipboard
abstract fun options(): EngineOptions
Returns the options the current engine was initialized with.
Link copied to clipboard
abstract fun permissions(): Permissions
Returns a service that allows managing permissions.
Link copied to clipboard
abstract fun plugins(): Plugins
Returns a service that allows configuring plugins.
Link copied to clipboard
abstract fun profiles(): Profiles
Returns a service for managing profiles.
Link copied to clipboard
abstract fun proxy(): Proxy
Returns a service that allows working with proxy.
Link copied to clipboard
abstract fun setTheme(theme: Theme)
Updates the Chromium theme.
Link copied to clipboard
abstract fun spellChecker(): SpellChecker
Returns a service that allows working with spell checking functionality.
Link copied to clipboard
inline fun <E : Event> Observable<in E>.subscribe(observer: Observer<E>): Subscription
inline fun <E : Event> Observable<in E>.subscribe(observer: Observer<E>): Subscription

Subscribes the given observer to receive events of type E from this Observable.

Link copied to clipboard
abstract fun theme(): Theme
Returns the current Chromium theme.
Link copied to clipboard
abstract fun zoomLevels(): ZoomLevels
Returns a service that allows working with zoom.